package thread;

/**
 * 两个线程合成一个线程
 * 
 * @author HXZY
 *
 */

public class Demo3 {

	public static void main(String[] args) throws InterruptedException {
		Thread4 t4 = new Thread4();// 创建线程t4
		t4.start();
		for (int i = 0; i < 10; i++) {
			if (i == 5)
				t4.join();// 当main执行到4的时候，就会把t4执行完，再把main执行完
			System.out.println("main=>" + i);
		}

	}

}

class Thread4 extends Thread {
	@Override
	public void run() {
		for (int i = 0; i < 10; i++) {
			System.out.println("t4==>" + i);
		}
	}
}